package SoftwareEngineering01.WordFrequence;

import SoftwareEngineering01.WordFrequence.Step0.Counting;
import SoftwareEngineering01.WordFrequence.Step1.Counting_01;
import SoftwareEngineering01.WordFrequence.Step1.Counting_01L;
import SoftwareEngineering01.WordFrequence.Step1.Search;
import SoftwareEngineering01.WordFrequence.Step1.SearchDir;
import SoftwareEngineering01.WordFrequence.Step2.StopWord;
import SoftwareEngineering01.WordFrequence.Step3.Counting_02;
import SoftwareEngineering01.WordFrequence.Step4.UniteVerb;
import SoftwareEngineering01.WordFrequence.readFile.Article;

import java.io.File;
import java.io.IOException;

public class wordFrequence {
    public static void main(String[] args) throws IOException {
        for(String s:args){
            System.out.println(s);
        }
        String stringPath = "C:\\Users\\AA\\IdeaProjects\\repository\\SoftwareEngineering01\\one.txt";
        File file = new File(stringPath);
        int len = args.length;
        String string = Article.article(file);
        if(len > 1 && args[len-1].equals("v")){
            System.out.println("动词归一化");
            String _string = args[args.length-1];
            File file1 = new File("C:\\Users\\AA\\IdeaProjects\\repository\\SoftwareEngineering01\\verb.txt");
            string = UniteVerb.uniteVerb(string,file);
            len--;
        }
        if(len == 1 && args[0].equals("c")) {
            System.out.println("统计字母ing: ");
            Counting.counting(string);
        }else if(len == 1 && args[0].equals("f")){
            System.out.println("统计单词ing: ");
            Counting_01.counting_01(string);
        }else if(len == 2 && args[0].equals("d")){
            System.out.println("寻找文件ing: ");
            String dir = args[1];
            Search.SearchFor(dir);
        }else if(len == 3 && args[0].equals("d") && args[1].equals("s")){
            System.out.println("递归寻找文件ing: ");
            String dir = args[2];
            SearchDir.searchDir(dir);
        }else if(len == 2 && args[0].equals("f")){
            int n = Integer.parseInt(args[1]);
            System.out.printf("统计最多的前%d单词ing: \n",n);
            Counting_01L.counting_01L(string,n);
        }else if(len == 2 && args[0].equals("x") && args[1].equals("f")){
            System.out.println("统计跳过停表的单词ing: ");
            StopWord.stopWord(string);
        }else if(len == 2 && args[0].equals("p")){
            int n = Integer.parseInt(args[1]);
            System.out.printf("统计%d个单词的短语ing: \n",n);
            Counting_02.counting_02(string,2);
        }else{
            System.out.println("不存在这个命令，输入错误");
        }
    }
}
